package com.im.project.webSocket;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置netty服务端初始化启动
 *
 * @author yunZhouJiaDi
 */
@Configuration
public class WebSocketInit {

    @Value("${websocket.port}")
    private int port;

    @Bean
    public WebSocketServer createNettyServer() {
        WebSocketServer webSocketServer = new WebSocketServer();
        new Thread(() -> webSocketServer.run(port)).start();
        return webSocketServer;
    }
}
